﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Wicresoft.Web.Controls
{
    public class ResourceButton : System.Web.UI.WebControls.Button
    {
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (!this.DesignMode)
            {
                string text = Resources.GlobalButton.ResourceManager.GetString(this.Text);
                if (string.IsNullOrEmpty(text))
                    throw new Exception(string.Format("Resource name '{0}' for Text could not be found in GlobalButton.resx", this.Text));
                else
                    this.Text = text;
                string tips = Resources.GlobalButton.ResourceManager.GetString(this.ToolTip);
                if (string.IsNullOrEmpty(tips))
                    throw new Exception(string.Format("Resource name '{0}' for ToolTips could not be found in GlobalButton.resx", this.ToolTip));
                else
                    this.ToolTip = tips;
            }
            base.Render(writer);
        }
    }
}
